package com.lzy.service.impl;

import com.lzy.mapper.hotelsMapper;
import com.lzy.pojo.hotels;
import com.lzy.service.hotelsService;
import com.lzy.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.util.List;

public class hotelsServiceImpl implements hotelsService {
    SqlSessionFactory factory = SqlSessionFactoryUtils.getSqlSessionFactory();
    @Override
    public hotels select(String hotels_num) {
        SqlSession sqlSession = factory.openSession();
        hotelsMapper mapper = sqlSession.getMapper(hotelsMapper.class);
        hotels hotels = mapper.select(hotels_num);
        sqlSession.close();
        return hotels;
    }

    @Override
    public List<hotels> selectAll() {
        SqlSession sqlSession = factory.openSession();
        hotelsMapper mapper = sqlSession.getMapper(hotelsMapper.class);
        List<hotels> hotels = mapper.selectAll();
        sqlSession.close();
        return hotels;
    }
}
